The getPrice method returns execution's original price.
var getPrice();
This method returns a floating value representing execution's price.
The following example demonstrates the use of getPrice() method.
function start()
{
//retrieve account's executions orders
var account = getAccount();
var executions = account.getExecutions(getSymbol());
//loop through all executions and calculate average price value
var totalPrices = 0;
for(var i = 0; i < executions.length, i++)
{
var execution = executions[i];
totalPrices += execution.getPrice();
}
//calculate average price value for all executions
var averagePrice = totalPrices / executions.length;
}
Copyright © 2006-2009 ActiveTick LLC